﻿<navigation:Page x:Class="SMS.Views.Reports.CustomerReport" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
                 xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                 xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:my="clr-namespace:SMS.Controls;assembly=SMS.Controls"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Customer Report">
    <Grid x:Name="LayoutRoot"
          Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="215" />
                <ColumnDefinition Width="3" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border BorderBrush="Black"
                    BorderThickness="1">
                <my:SMSReportControl Margin="5"></my:SMSReportControl>
            </Border>

            <Border Grid.Column="2"
                    BorderBrush="Black"
                    BorderThickness="1">
                <Grid Margin="5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <sdk:DataGrid x:Name="grd_CustomerReport"
                                  AutoGenerateColumns="False"
                                  IsReadOnly="True"
                                  ItemsSource="{Binding ReportCollection}"
                                  SelectedItem="{Binding SelectedReportData, Mode=TwoWay}">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTemplateColumn Header="Group"
                                                        Visibility="Collapsed">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <HyperlinkButton NavigateUri="{Binding Path=.,Converter={StaticResource LinkConverter}, ConverterParameter=Monthly-CustomerReport}"
                                                         Content="{Binding Path=., Converter={StaticResource ReportContentConverter}, ConverterParameter=Monthly}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Group"
                                                        Visibility="Collapsed">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <HyperlinkButton NavigateUri="{Binding Path=.,Converter={StaticResource LinkConverter}, ConverterParameter=Weekly-CustomerReport}"
                                                         Content="{Binding Path=., Converter={StaticResource ReportContentConverter}, ConverterParameter=Weekly}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Group"
                                                        Visibility="Collapsed">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <HyperlinkButton Content="{Binding Path=., Converter={StaticResource ReportContentConverter}, ConverterParameter=Daily}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Group"
                                                        Visibility="Collapsed">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <HyperlinkButton NavigateUri="{Binding Path=.,Converter={StaticResource LinkConverter}, ConverterParameter=Quarterly-CustomerReport}"
                                                         Content="{Binding Path=., Converter={StaticResource ReportContentConverter}, ConverterParameter=Quarterly}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Group"
                                                        Visibility="Collapsed">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <HyperlinkButton NavigateUri="{Binding Path=.,Converter={StaticResource LinkConverter}, ConverterParameter=HalfYearly-CustomerReport}"
                                                         Content="{Binding Path=., Converter={StaticResource ReportContentConverter}, ConverterParameter=HalfYearly}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Group"
                                                        Visibility="Collapsed">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <HyperlinkButton NavigateUri="{Binding Path=.,Converter={StaticResource LinkConverter}, ConverterParameter=Yearly-CustomerReport}"
                                                         Content="{Binding Path=., Converter={StaticResource ReportContentConverter}, ConverterParameter=Yearly}" />
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTextColumn Header="Year"
                                                    Binding="{Binding Year}"></sdk:DataGridTextColumn>
                            <sdk:DataGridTextColumn Header="Customer Name"
                                                    Binding="{Binding CustomerName}"></sdk:DataGridTextColumn>
                            <sdk:DataGridTextColumn Header="Total Selling Price"
                                                    Binding="{Binding TotalSellingPrice}"></sdk:DataGridTextColumn>
                            <sdk:DataGridTextColumn Header="Total Income"
                                                    Binding="{Binding TotalIncome}"></sdk:DataGridTextColumn>

                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                    <toolkit:Chart  x:Name="Chart"
                                    Visibility="Collapsed">

                        <toolkit:ColumnSeries Title="Sales Report"
                                              ItemsSource="{Binding Path=ReportCollection}"
                                              DependentValuePath="SellingAmount"
                                              IndependentValueBinding="{Binding Path=GroupNo}" />
                    </toolkit:Chart>
                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Button Content="GRID VIEW"
                                Click="Button_Click_1" />
                        <Button Content="CHART VIEW"
                                Click="Button_Click"
                                Grid.Column="1" />
                    </Grid>

                </Grid>
            </Border>
        </Grid>
        <sdk:DataPager HorizontalAlignment="Right"
                       Grid.Row="1"
                       Source="{Binding Path=ItemsSource, ElementName=grd_CustomerReport}"
                       Width="250"
                       PageSize="12" />

        <Grid Grid.Row="3">
            <my:ErrorControl HorizontalAlignment="Left"
                             Name="errorControl1"
                             VerticalAlignment="Top" />
        </Grid>
    </Grid>
</navigation:Page>
